




<%@page isELIgnored="false" contentType="text/html; utf-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/back/statics/css/bootstrap.min.css">
	<title>城市列表</title>
</head>
<body>

<div class="container-fluid">
	<div class="row">
		<div class="col-sm-12">
			<input type="button" class="btn btn-success btn-sm" value="添加城市" onclick="location.href='${pageContext.request.contextPath}/back/city/add.jsp'"/>
		</div>
	</div>
	<div class="row" style="margin-top: 15px;">
		<div class="col-sm-12">
			<table class="table table-striped table-bordered table-hover">
				<tr>
					<th>编号</th>
					<th>名称</th>
					<th>操作</th>
				</tr>




				<c:forEach var="city" items="${requestScope.citys}">
					<tr >

						<td>${city.id}</td>

						<td>${city.name}</td>

						<td>
							<a href="${pageContext.request.contextPath}/city/deleteCity?id=${city.id}" class="btn btn-danger btn-sm">删除</a>&nbsp;
						</td>
					</tr>
				</c:forEach>


			</table>
		</div>
		<div class="col-sm-4 col-sm-offset-8">
			<nav aria-label="Page navigation">
				<ul class="pagination">
					<li>

						<%--判断上一页--%>
						<c:if test="${requestScope.pageNumber > 1}">
						<a href="${pageContext.request.contextPath}/city/findByPage?pageNumber=${requestScope.pageNumber-1}" aria-label="Previous">
							<span aria-hidden="true">&laquo;</span>
						</a>
						</c:if>


							<c:if test="${requestScope.pageNumber <= 1}">
							<a href="#" aria-label="Previous">
								<span aria-hidden="true">&laquo;</span>
							</c:if>

					</li>


					<li>
					<%--遍历页号--%>
					<c:forEach var="page" begin="1" end="${requestScope.totalPage}">
						<a href="${pageContext.request.contextPath}/city/findByPage?pageNumber=${page}"> ${page}  </a>
					</c:forEach>
					</li>


					<li>
						<%--判断下一页--%>
						<c:if test="${requestScope.pageNumber < requestScope.totalPage}">
							<a href="${pageContext.request.contextPath}/city/findByPage?pageNumber=${requestScope.pageNumber+1}" aria-label="Next">
								<span aria-hidden="true">&raquo;</span>
							</a>
						</c:if>
							<c:if test="${requestScope.pageNumber >= requestScope.totalPage}">
								<a href="#" aria-label="Next">
									<span aria-hidden="true">&raquo;</span>
								</a>
							</c:if>
					</li>

				</ul>
			</nav>
		</div>
	</div>

</div>


</body>
</html>